home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / eflibpt4.zip / DEMO / DEVICES / MOUSE1.PAS < prev    next >
Pascal/Delphi Source File  |  1996-08-16  |  2KB  |  36 lines

  1. { Borland Pascal Extended Function Library - EFLIB (C) Johan Larsson, 1996
  2.   Demonstration; mouse handling #1
  3.  
  4.   EFLIB IS PROTECTED BY THE COPYRIGHT LAW AND MAY NOT BE COPIED, SOLD OR
  5.   MANIPULATED. FOR MORE INFORMATION, SEE PROGRAM MANUAL! THIS DEMONSTRAT-
  6.   ION PROGRAM MAY FREELY BE USED AND DISTRIBUTED.                          }
  7.  
  8.  
  9. uses EFLIBDEF, EFLIBSCR, EFLIBMSE, EFLIBKBD, EFLIBTXT, CRT;
  10.  
  11.  
  12. begin
  13.      Screen.HideCursor;
  14.      with Mouse, Profile.Video do begin
  15.           { Initialize mouse (not needed other than if text mode changed) }
  16.           Reset;
  17.           ShowCursor;
  18.           { Set mouse cursor area to demonstrate restricted mouse area }
  19.           CursorBox (1, 1, Trunc(Width/1.2), Height);
  20.           { Hide mouse if it enters the following area }
  21.           ConditionalOff ((Width-12) div 2, Height div 2,
  22.                           (Width-12) div 2 + 12, Height div 2 + 3);
  23.           repeat
  24.                 { NOTE! Use CRT's GotoXY - not Mouse.GotoXY }
  25.                 CRT.GotoXY ((Width-12) div 2, Height div 2);
  26.                 WriteLn (WhereX:2, WhereY : 10);
  27.                 CRT.GotoXY ((Width-12) div 2, Height div 2 + 1);
  28.                 WriteLn (LastPressedX (MSE_LeftButton) : 2, LastPressedY (MSE_LeftButton) : 10);
  29.                 CRT.GotoXY ((Width-12) div 2, Height div 2 + 2);
  30.                 WriteLn (LastReleasedX (MSE_LeftButton) : 2, LastReleasedY (MSE_LeftButton) : 10);
  31.                 CRT.GotoXY ((Width-12) div 2, Height div 2 + 3);
  32.                 WriteLn (StringBoolean(LeftButtonPressed) : 5, StringBoolean(RightButtonPressed) : 7);
  33.                 ShowCursor; { Show mouse cursor if it has been hidden }
  34.           until (LeftButtonPressed and RightButtonPressed) or Keyboard.KeyPressed;
  35.      end;
  36. end.